//
//  EAOpinionViewController.m
//  WhatToEat
//
//  Created by Mac on 15/4/2.
//  Copyright (c) 2015年 Mac. All rights reserved.
//

#import "EAOpinionViewController.h"

@interface EAOpinionViewController ()
@property (strong, nonatomic) IBOutlet UITextView *textView;
@property (strong, nonatomic) IBOutlet UIButton *okBtn;

@end

@implementation EAOpinionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
 
    self.navigationItem.title=@"意见反馈";
    
    
    self.textView.layer.borderWidth=1.0;
    self.textView.layer.borderColor=kTingColor.CGColor;
    self.textView.clipsToBounds=YES;
    self.textView.layer.cornerRadius=kRadius;
    
    self.okBtn.layer.cornerRadius=kRadius;
    self.okBtn.clipsToBounds=YES;
    if ([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)]) {
        self.automaticallyAdjustsScrollViewInsets = NO;

    }
    
}

- (IBAction)okAction:(UIButton *)sender {
    
    if (self.textView.text.length==0) {
        [SVProgressHUD showImage:nil status:@"请输入反馈内容"];
    }
    
    
    
    
    [WebAPI webAPISignAddMd5tWithNote:@"user/feedback" parm:@{@"userID":ApplicationDelegate.userId,
                                                            @"content":self.textView.text
                                                            
                                                            } completed:^(NSInteger state, AFHTTPRequestOperation *operation, id responseObject) {
                                                                
                                     
                                                                NSString *msg=[NSString stringWithFormat:@"%@",responseObject[@"code"]];
                                                                
                                                                
                                                                if ([msg isEqualToString:@"1"]) {
                                                                    
                                                                    [SVProgressHUD showImage:nil status:@"意见反馈成功"];
                                                                    
                                                                    [self.navigationController popViewControllerAnimated:YES];
                                                                    
                                                                    
                                                                    
                                                                    
                                                                    
                                                                }
                                                                
                                                                
                                                                
                                                            }];
     
    
    
    
    
}


@end
